package com.abigdreamer.im.client.module.main.headtree;

import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JDialog;

import com.abigdreamer.im.client.module.vo.MsgUser;
import com.abigdreamer.im.client.resourse.ResourcesManagement;
import com.abigdreamer.swing.component.JCLabel;

/**
 * 
 */
public class UserPopoInfo extends JDialog implements MouseListener {
	
	private static final long serialVersionUID = 3352296315001542660L;
	private MsgUser user;

	public UserPopoInfo() {
	}

	public UserPopoInfo(MsgUser user) {
		this.user = user;
		JCLabel lblUserName = new JCLabel(user.getUserName());
		Icon icon = new ImageIcon(this.getClass().getResource("1111.jpg"));
		lblUserName.setIcon(icon);
		this.setTitle(user.getUserName() + "的基本信息");
		String iconImagePath = "head/" + (String) user.getAttribute("headImage") + ".gif";
		Image image = ResourcesManagement.getImage(iconImagePath, 32, 32);
		this.getContentPane().add(lblUserName);
		this.setIconImage(image);
		this.setSize(300, 180);
		this.setUndecorated(true);
		this.setAlwaysOnTop(true);
		// com.sun.awt.AWTUtilities.setWindowOpacity(this, 0.9f);
	}

	public void mouseClicked(MouseEvent e) {

	}

	public void mouseEntered(MouseEvent e) {
		this.setVisible(true);
	}

	public void mouseExited(MouseEvent e) {
		this.setVisible(false);
	}

	public void mousePressed(MouseEvent e) {

	}

	public void mouseReleased(MouseEvent e) {

	}

	public static void main(String[] args) {
		UserPopoInfo loadingFrame = new UserPopoInfo();
		loadingFrame.setLocationRelativeTo(null);
		loadingFrame.setVisible(true);
	}
}
